<template>
    <el-dialog 
      ref="sele"
      :visible="showAggreTipDialog" 
      @close="close" 
      title="备注"
      width="500px"
    >
    <el-input
    type="textarea"
    :rows="6"
    v-model="textarea">
    </el-input>
          <!-- 按钮 -->
      <el-row type="flex" justify="center" style="margin-top: 40px;">
        <el-col :span="12">
          <el-button size="mini" type="primary" @click="btnOK">确定</el-button>
          <el-button size="mini" @click="close">取消</el-button>
        </el-col>
      </el-row>
    </el-dialog>
    
  </template>
  <script>
  import { changeTip } from '@/api/employee'
    export default {
      props: {
        showAggreTipDialog: {
          type: Boolean,
          default: false
        },
        cId: {
            type: Number,
            default: null
        }
      },
      data() {
        return {
            textarea: ''
        };
      },
      methods: {
        getTips(tips) {
          this.textarea = tips
        },
        close() {
          this.$emit('update:showAggreTipDialog', false)
        },
        // 点击确定时调用
        async btnOK() {
          const data = {
            id : this.cId,
            tips: this.textarea
          }
          await changeTip(data)
          // 通知父组件更新
          this.$emit('alertDistributeInfo')
          // 提示消息
          this.close()
        },
        tipVisible() {
          return this.$parent.aggreCheck()
        }
      }
    };
  </script>